<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="../../Templates/SubFolderTemplate.xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">
<ui:define name="head-title">
        <title>Weekly Production Plan | Merlion's ERP System</title>
    </ui:define>
    <ui:define name="content">
        <f:view beforePhase="#{weeklyProductionPlan.initView}">
            <p:tabView>
                <p:tab title="Product A">
                    <p:panel style="width: 600px; max-width: 600px; overflow: scroll; border-style: none;">
                        <h:form prependId="false">   
                            <p:dataTable var="data" value="" id="tableA">  
                                <p:columns value="#{weeklyProductionPlan.simpleColumns}"  
                                            var="column" columnIndexVar="colIndex">  
                                    <f:facet name="header">  
                                        #{column.header}  
                                    </f:facet>  

                                    <h:form>  
                                        <p:dataTable var="row" value="#{weeklyProductionPlan.dataListA}">  
                                            <p:column>
                                                <f:facet name="header">  
                                                </f:facet> 
                                                <h:outputText value="#{row[column.property]}" />
                                            </p:column>                      
                                        </p:dataTable>  
                                    </h:form>  
                                </p:columns>  
                            </p:dataTable>  
                        </h:form>
                    </p:panel>
                </p:tab >
                <p:tab title="Product B">
                    <p:panel style="width: 600px; max-width: 600px; overflow: scroll; border-style: none;">
                        <h:form prependId="false">  
                            <p:dataTable var="data" value="" id="tableB">  
                                <p:columns value="#{weeklyProductionPlan.simpleColumns}"  
                                            var="column" columnIndexVar="colIndex">  
                                    <f:facet name="header">  
                                        #{column.header}  
                                    </f:facet>  

                                    <h:form>  
                                        <p:dataTable var="row" value="#{weeklyProductionPlan.dataListB}">  
                                            <p:column>
                                                <f:facet name="header">  
                                                </f:facet> 
                                                <h:outputText value="#{row[column.property]}" />
                                            </p:column>                      
                                        </p:dataTable>  
                                    </h:form>  
                                </p:columns>  
                            </p:dataTable>  
                       </h:form>
                    </p:panel>
                </p:tab>
                <p:tab title="Product C">
                    <p:panel style="width: 600px; max-width: 600px; overflow: scroll; border-style: none;">
                        <h:form prependId="false">       
                            <p:dataTable var="data" value="" id="tableC">  
                                <p:columns value="#{weeklyProductionPlan.simpleColumns}"  
                                            var="column" columnIndexVar="colIndex">  
                                    <f:facet name="header">  
                                        #{column.header}  
                                    </f:facet>  

                                    <h:form>  
                                        <p:dataTable var="row" value="#{weeklyProductionPlan.dataListC}">  
                                            <p:column>
                                                <f:facet name="header">  
                                                </f:facet> 
                                                <h:outputText value="#{row[column.property]}" />
                                            </p:column>                      
                                        </p:dataTable>  
                                    </h:form>  
                                </p:columns>  
                            </p:dataTable>  
                        </h:form>
                    </p:panel>
                </p:tab>
                <p:tab title="Product D">
                    <p:panel style="width: 600px; max-width: 600px; overflow: scroll; border-style: none;">
                        <h:form prependId="false">      
                            <p:dataTable var="data" value="" id="tableD">  
                                <p:columns value="#{weeklyProductionPlan.simpleColumns}"  
                                            var="column" columnIndexVar="colIndex">  
                                    <f:facet name="header">  
                                        #{column.header}  
                                    </f:facet>  

                                    <h:form>  
                                        <p:dataTable var="row" value="#{weeklyProductionPlan.dataListD}">  
                                            <p:column>
                                                <f:facet name="header">  
                                                </f:facet> 
                                                <h:outputText value="#{row[column.property]}" />
                                            </p:column>                      
                                        </p:dataTable>  
                                    </h:form>  
                                </p:columns>  
                            </p:dataTable>  
                        </h:form>      
                    </p:panel>
                </p:tab>
            </p:tabView>
            <h:form>
                <h:selectOneMenu value="#{weeklyProductionPlan.week}" required="true" requiredMessage="Choose month">
                    <f:selectItem itemLabel="Select One" itemValue="" />  
                    <f:selectItems value="#{weeklyProductionPlan.weekList}"/>
                </h:selectOneMenu>
                <p:commandButton value="Generate Daily Production Plan" actionListener="#{weeklyProductionPlan.generateDaily(event)}" ajax="true" />
                <br/>
            </h:form>
        </f:view>
    </ui:define>
</ui:composition>